<div class="right_side_operate_area">
	<div>
		<?php  
			$user=$session->read('User');
			if($showpage==1) {
				if(isset($paging)){ echo $this->renderElement('pagination',$paging);} 
			}
		?>
		<div class="right search_box">
			<form onsubmit="return searchtal()">
		    	<div class="left search_text">
		    		<?php echo $form->text('company.keyword',array('placeholder'=>'搜索人才项目名称','value'=>$keyword, 'id'=>'talkey', 'class'=>'text_box'));?>
		    	</div>
		        <div class="left search_btn"><input type="submit" value=""/></div>
	        </form>
	    </div>
	    <div class="right search_box">
		<form onsubmit="return searchtal()">
	    	<div class="left search_text">
	    		<?php echo $form->text('company.enterprise',array('placeholder'=>'搜索企业名称','value'=>$enterprise, 'id'=>'search', 'class'=>'text_box'));?>
	    	</div>
	        <div class="left search_btn"><input type="submit" value=""/></div>
        </form>
        <div class="clear"></div>
    </div>
	    <div class="term_choose_area right">
	    	<a class="term_choose_btn" id="term_choose_btn"  title="选择"></a>
	    	<div class="screen_list" id="screen_list" style="display:none;visibility:hidden;">
	    		<ul>
	    			<?php 
	    			foreach($industrys as $key=>$strindustry){
	    				$selected="";
	    				if($industry==$key){
	    					$selected="selected";
	    				}
	    				echo '<li class="'.$selected.'">';
	    				echo $html->link($strindustry,"javascript:void(0)",array("onclick"=>"return setindustry('".$key."')","class"=>$selected));
	    				echo '</li>';
	    			}
	    			?>
	    		</ul>
	    		<div id="industry" style="display:none"><?php echo $industry?></div>
	    	</div>
	    </div>
	    <div class="clear"></div>
		<div class="right_side_title right">
			<?php 
			if($user['isadmin']||$user['isvisitor']){
				$grouplist=array_merge(array(""=>"请选择模块"),$grouplist);
    			echo $form->select('ddlgroup',$grouplist,$group_mod_id, null,null);
			}
    		?>
			<?php 
			$objyear=$str->getafteryear(1,2008,"请选择申报时间");
	    	echo $form->select('ddlyear',$objyear, $year, null,null);
			?>
			<?php 
			echo $form->select('ddlgov',$talstacktype, $selecttalstacktype, null,null);
			?>
			<?php 
			if($taltype){
				echo $form->select('ddltal',$taltype, $selectdeclaretype, null,null);
			}
			?>
			<?php 
			if(!empty($subtype1)){
	    		echo $form->select('ddltype1',$subtype1, $selecttype1, null,null);
	    	}
	    	?>
			<?php 
	    	if(!empty($subtype2)){
	    		echo $form->select('ddltype2',$subtype2, $selecttype2, null,null);
	    	}
			?><div id="tal" style="display:none"></div>
			<?php 
				$dstatus=array_merge(array(""=>"请选择状态"),$dstatus);
				echo $form->select('ddldstatus',$dstatus, $selectdstatus, null,null);
			?>
			<div id="dstatus" style="display:none"><?php echo $selectdstatus?></div>
		</div>
		<?php if($selectdeclaretype){?>
			<div class="right_side_title left">
					<h2><?php echo $taltype[$selectdeclaretype];?></h2>
			</div>
		<?php }?>
    	<div class="clear"></div>
	</div>
	<?php
     $desc="";
     if($selectdeclaretype){
		 $talstack=classregistry::init('Talstack')->findById($selectdeclaretype);
		 $desc=$talstack["Talstack"]["desc"];
	 }
	 if($selectdeclaretype && $desc){ ?>
	<div class="right_sidt_head_screen">
		<div class="right_side_head_line">
			<div class="match_condition_desc">
				<span>人才政策：</span>
				<label id="subdec">
				<?php 
				
				    echo $str->sub_len($desc,10);
				?>
				</label>
				<?php if($str->isetc){?>
				<label id="desc" style="display:none"><?php echo  $desc?></label>
				<a onclick="showdesc(this)" href="javascript:void(0)">展开</a>
				<script>
					function showdesc(obj){
						var desc=$("#desc").css("display");
						if(desc=="none"){
							$("#subdec").css("display","none");
							$("#desc").css("display","");
							$(obj).html("收缩");
						}else{
							$("#desc").css("display","none");
							$("#subdec").css("display","");
							$(obj).html("展开");
						}
					}
				</script>
				<?php }?>
			</div>
		</div>
	</div>
	<?php }?>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
        	<table>
            	<tr>
                    <th>企业名称</th>
                    <th>模块</th>
                    <th>人才项目名称</th>
                    <th>申报类型</th>
                    <th>主管部门</th>
                    <th>申报状态</th>
                    <th>申报时间</th>
                </tr>
                <?php 
				foreach($companys as $company){
					$id=$company["SearchCompany"]["id"];
					$company_name=$company["SearchCompany"]["company_name"];
					$showcname=$html->link($str->sub_len($company_name,20),"/companys/showinfosummary/".$id,array("title"=>$company_name),null);
					$groupname=$grouplist[$company["SearchCompany"]["groupid"]];
					$objtals=$company["CompTalent"];
					$objteccount=count($objtals);
					$i=0;
					if(!empty($objtals)){
						foreach($objtals as $talent){
							echo "<tr class='per_list'>";
							if($i==0){
								echo "<td rowspan='".$objteccount."'>".$showcname."</td>";
							}
							$declare_name=$talent["declare_name"];
							echo "<td>".$html->link($str->sub_len($declare_name,20),"/searchs/showtalent/".$talent["id"]."/".$id."/".$company_name,array("title"=>$declare_name),null)."</td>";
							$tvalue=$talent['type_id'];
							classregistry::init('Talstack')->tname="";
							classregistry::init('Talstack')->showtname($tvalue);
							$tname=rtrim(classregistry::init('Talstack')->tname,"/");
							$gov=classregistry::init('Talstack')->gov;
//							$tids=classregistry::init('Talstack')->tid;
//							$tid="";
//							if($tids){
//								$objtid=explode('/',$tids);
//								$tid=$objtid[0];
//							}
							echo "<td>".$groupname."</td>";
							echo "<td>".$tname."</td>";//"<td>".$html->link($tname,"/searchs/talentdb?seach=all&tal=".$tid)."</td>";
							classregistry::init('Talstack')->tname="";
//							classregistry::init('Talstack')->tid="";
							echo "<td>".$str->getkeystr($gov,$techtype)."</td>";
							classregistry::init('Talstack')->gov="";
							echo "<td>".$str->getkeystr($talent["declarate_status"],$dstatus)."</td>";
							$declare_time=date("Y-m-d",strtotime($talent["declare_time"]));
							echo "<td>".$declare_time."</td>";
							echo "</tr>";
							$i++;
						}
					}
					if($i==0){
						echo "<tr class='per_list'>";
						echo "<td>".$showcname."</td>";
						echo "<td>".$groupname."</td>";
						echo "<td></td><td></td><td></td><td></td>";
						echo "</tr>";
					}
				}?>
            </table>
		</div>
	</div>
</div>
<?php //echo $this->element('autocomplete',array("model_name"=>"Company","field_name"=>"company_name","widget_name"=>"talkey")) ?>
<script>
var webpath=$("#getpath").attr('href');
var urlpath=webpath+"searchs/talentdb?seach=all";
$(document).ready(function() {
	$("#ddlgroup").change(function(){
		searchtal();
		});	
	$("#ddlyear").change(function() {  
		searchtalyear();
	});
	$("#ddlgov").change(function() {  
		searchtal();
	});
	$("#ddltal").change(function() {  
		$("#tal").html(this.value);
		searchtal();
	});
	$("#ddltype1").change(function() { 
		if(this.value==""){
			$("#tal").html($("#ddltal").val());
		}else{
			$("#tal").html(this.value);
		}
		searchtal();
	});
	$("#ddltype2").change(function() {  
		if(this.value!=""){
			$("#tal").html(this.value);
			searchtal();
		}
	});
	$("#ddldstatus").change(function() {  
		$("#dstatus").html(this.value);
		searchtal();
	});
});
if($("#talkey").val()!=""){
	$("#talkey").focus();
}
if($("#search").val()!=""){
	$("#search").focus();
}
function searchtal()
{	var group=$("#ddlgroup").val();
	var year=$("#ddlyear").val();
	var gov=$("#ddlgov").val();
	var tal=$("#ddltal").val();
	var search=$("#search").val();
	var talkey=$("#talkey").val();
	var dstatus=$("#dstatus").html();
	var inid=$("#industry").html();
	if(group=="" && year=="" && gov=="" && tal=="" && dstatus=="" && talkey=="" && inid=="" && search==""){
		location.href=urlpath;
	}else{
		if(group!=""){
			urlpath+="&group="+group;
			}
		if(year!=""){
			urlpath+="&year="+year;
		}
		var path="";
		if($("#tal").html()!=""){
			urlpath+="&tal="+$("#tal").html();
		}
		if(gov!=""){
			urlpath+="&gov="+gov;
		}
		if(dstatus!=""){
			urlpath+="&dstatus="+dstatus;
		}
		if(search.trim()!=""){
			urlpath+="&enterprise="+encodeURIComponent(search.trim());
		}
		if(talkey.trim()!=""){
			urlpath+="&keyword="+encodeURIComponent(talkey.trim());
		}
		if(inid.trim()!=""){
			urlpath+="&industry="+inid.trim();
		}
		location.href=urlpath;
	}
	return false;
}
function setindustry(inid){
	$("#industry").html(inid);
	return searchtal();
}
function searchtalyear(){
	var year=$("#ddlyear").val();
	var gov=$("#ddlgov").val();
	var tal=$("#ddltal").val();
	var tal1=$("#ddltype1").val();
	var tal2=$("#ddltype2").val();
	var dstatus=$("#dstatus").html();
	var talkey=$("#talkey").val();
	var search=$("#search").val();
	var inid=$("#industry").html();
	var path="";
	if(year=="" && gov=="" && tal=="" && dstatus=="" && talkey=="" && inid=="" && search==""){
		location.href=urlpath;
	}else{
		if(year!=""){
			urlpath+="&year="+year;
		}
		if(tal!=null && tal!=""){
			path="&tal="+tal;
		}
		if(tal1!=null && tal1!=""){
			path="&tal="+tal1;
		}
		if(tal2!=null && tal2!=""){
			path="&tal="+tal2;
		}
		if(gov!=""){
			urlpath+="&gov="+gov;
		}
		if(dstatus!=""){
			urlpath+="&dstatus="+dstatus;
		}
		if(talkey.trim()!=""){
			urlpath+="&keyword="+encodeURIComponent(talkey.trim());
		}
		if(search.trim()!=""){
			urlpath+="&enterprise="+encodeURIComponent(search.trim());
		}
		if(inid.trim()!=""){
			urlpath+="&industry="+inid.trim();
		}
	}
	location.href=urlpath+path;
	return false;
}

function focuseEV(C,B,A){
	if(window.attachEvent){
		C.attachEvent("on"+B,A);
	}else{
		if(window.addEventListener){
			C.addEventListener(B,A,false);
		}
	}
}
focuseEV(document,"click",function(E){
	var E=E||window.event;
	var A=E.target||E.srcElement;
	var D=window.event?E.button:E.which;
	var C=G("term_choose_btn"),B=G("screen_list");
	while(A&&A!=document.body&&A.tagName.toLowerCase()!="html"){
		if(A==C){break}
		if(A==B){break}
		A=A.parentNode
	}
	if(A==B){
	}else if(A!=C){
		B.style.display="none"
			B.style.visibility="hidden"
	}else{
		if(D<2){
			B.style.display=B.style.display=="block"?"none":"block";
			B.style.visibility=B.style.visibility=="hidden"?"visible":"hidden";
		}
	}
});
funPlaceholder(document.getElementById("search"));
funPlaceholder(document.getElementById("talkey"));
</script>